import http from '../libs/axios.js'

// 接口参数
export const apiConfig = {
  user: {
    getList: {
      url:'/list',
    },
    getDetails: {
      url:'/details',
      type:'post'
    }
  },
}

// 获取列表
const Request = {};

(() =>{
  for(let categroy in apiConfig){
    let obj = apiConfig[categroy];

    for(let key in obj) {
      if(!obj[key].type){
        Request[key] = (params,config)=>{
          return http.get(obj[key].url,params,config);
        }
      } else if(obj[key].type == 'post') {
        Request[key] = (data,config) => {
          return http.post(obj[key].url,data,config);
        }
      }
    }
  }
})();

export default Request